package org.wattdepot.cli.command;

import static org.junit.Assert.assertTrue;
import org.junit.Test;

/**
 * Tests the quit method for correct output.
 * 
 * @author Alex Kan and Kelvin Green
 * @version 2.0
 */
public class TestWattDepotQuit {

  WattDepotCommand commandInstance;
  String[] commandArray;
  String userInput;

  /**
   * Test WattDepotQuit command for 1 correct output and 1 incorrect input.
   * 
   * Test (correct) quit: quit. Test (failed) quit 1: Correct command is quit
   */
  @Test
  public void testQuit() {
    WattDepotCommand.connect("http://server.wattdepot.org:8182/wattdepot/");
    commandInstance = new WattDepotQuitCommand();
    userInput = "quit";
    commandArray = userInput.split(" ");
    assertTrue("Check for quit", commandInstance.doCommand(commandArray).contains("quit"));

    userInput = "quit 1";
    commandArray = userInput.split(" ");
    assertTrue("Check for quit", commandInstance.doCommand(commandArray).contains(
        "Correct command is quit"));

  }

}